﻿--#include "data\functions\Activity\DailyActivity\SceneAnswer.lua"   once         		--每日场景答题
--#include "data\functions\Activity\DailyActivity\PanelAnswer.lua"   once         		--每日多人答题
--#include "data\functions\Activity\DailyActivity\PersonAnswer.lua"   once         		--每日单人答题
--#include "data\config\answer\AnswerRankAwardConfig.lua" once							--答题排行榜奖励

SCENE_ANSWER_ACTIVITY 	= 1				--场景答题活动(多人)
PANEL_ANSWER_ACTIVITY 	= 2				--面板答题活动(多人)
PERSON_ANSWER_ACTIVITY 	= 3				--个人答题活动(单人)

ANSWER_OPTYPE_CHOOSE_ANSWER = 1 			--选择答案
ANSWER_OPTYPE_ONEKEY_HIT 	= 2 			--一键正确
ANSWER_OPTYPE_TERMINATE 	= 3 			--终止答题
ANSWER_OPTYPE_OPEN_ANSWERDLG= 4 			--打开答题面板

AnswerRankColumn = 
{	
	{"name"},				--0，玩家Name
	{"serverId"},			--1，玩家ServerId(留空)
	{"job"},				--2，玩家职业
}

TodayAnswerRank 	= Lang.Rank.TodayAnswerRank			--答题积分榜周榜（日榜改周榜了）
YesterdayAnswerRank = Lang.Rank.YesterdayAnswerRank		--答题积分榜上周榜
SceneAnswerRank		= Lang.Rank.SceneAnswerRank			--活动答题积分榜（活动开始时清空）

function GmDoAnswer( sysarg, flag, param )
	print("GmDoAnswer, flag="..flag..", param="..param)
	if flag == 1 then
		if param == 1 then
			SceneAnswerStart()
		else
			SceneAnswerStop()
		end
	elseif flag == 2 then
		if param == 1 then
			PanelAnswerStart()
		else
			PanelAnswerStop()
		end
	elseif flag == 3 then
		if param == 1 then
			PersonAnswerStart( sysarg )
		else
			PersonAnswerStop( sysarg )
		end
	elseif flag == 4 then
		local myAnswerIdx = param
		SetPersonAnswerActorAnswerTest( sysarg, myAnswerIdx )
	elseif flag == 5 then
		OnAnswerDailyProc()
	end
end

--[[
初始化答题积分榜
]]
function InitAnswerRank()
	--print("*****>>InitAnswerRank...")
	Rank.Init(TodayAnswerRank, TodayAnswerRank, AnswerRankColumn, 1000, 0)
	Rank.Init(SceneAnswerRank, SceneAnswerRank, AnswerRankColumn, 1000, 0)
end

--[[
function OnAnswerDailyProc()
	SendCommonRankAwards( enCommonRankType_AnswerToday ) 			--日榜发奖
end
]]

--[[
每周一零点处理
]]
function OnAnswerMondayProc()
	--print("*****>>OnAnswerMondayProc...")
	SendCommonRankAwards( enCommonRankType_AnswerToday ) 			--周榜发奖
end

function DoActivityAnswerByType( sysarg, activityId, roundIdx, opType, param )
	--print("DoActivityAnswerByType, activityId="..activityId..", roundIdx="..roundIdx..", opType="..opType..", param="..param)
	if activityId == PERSON_ANSWER_ACTIVITY then
		DoPersonAnswerActorAnswer( sysarg, roundIdx, opType, param )
	elseif activityId == SCENE_ANSWER_ACTIVITY then
		DoSceneAnswerActorAnswer( sysarg, roundIdx, opType, param )
	end
end


InitAnswerRank()

